﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TMS.ProjectServiceImplement.DAL;
using TMS.ProjectServiceModel;

namespace UnitTestTMS.DAL
{
    [TestClass]
    public class TestProjectServiceImplementDAL
    {
        [TestMethod]
        public void TestInsert()
        {
            Project project = new Project
            {
                ID = 1,
                Status = 1,
              Description="test"
            };
            project = ProjectPublishDAL.Insert(project);
            Assert.IsNotNull(project);
        }

        [TestMethod]
        public void TestGet()
        {
            Project project = ProjectPublishDAL.Get(1);
            Assert.IsNotNull(project);
            if (project != null)
            {
                Assert.AreEqual(project.ID, 1);
            }
        }

        [TestMethod]
        public void TestDelete()
        {
            ProjectPublishDAL.Delete(1);
            Assert.AreEqual(1, 1);
        }

        [TestMethod]
        public void TestUpdate()
        {
            Project project = new Project();
            project.ID = 1;
            project.Description = "Description";
            project.LastBuildDate = DateTime.Now;
            project.LastBuildMessage = "LastBuildMessage";
            project.LastBuildStatus = "LastBuildStatus";
            project.LastFromDate = DateTime.Now;
            project.LastToDate = DateTime.Now;
            project.ProjectName = "ProjectName";
            project.ProjectTitle = "ProjectTitle";
            project.TestEnv = "TestEnv";
            project.Status = 3;

            Project search = ProjectPublishDAL.Update(project);
            Assert.IsNotNull(search.ObjectId);
        }

        [TestMethod]
        public void TestGetAllProject()
        {
            var c = ProjectPublishDAL.GetAllProject();
            Assert.IsNotNull(c);
            Assert.IsTrue(c.Count != 0);

        }

        [TestMethod]
        public void TestStatusInsert()
        {
            PublishStatus project = new PublishStatus
            {
                ID = 1,
                Status = "sss"
            };
            project = ProjectPublishStatusDAL.Insert(project);
            Assert.IsNotNull(project);
        }

        [TestMethod]
        public void TestStatusDelete()
        {
            ProjectPublishStatusDAL.Delete(1);
            Assert.AreEqual(1, 1);
        }
    }
}
